package com.my.main.base.entity.response;

import com.my.main.entity.userAndRight.SysUser;
import lombok.Getter;
import lombok.Setter;
import org.crazycake.shiro.AuthCachePrincipal;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.util.*;

@Setter
@Getter
public class ProfileResult implements Serializable, AuthCachePrincipal {
    private String userId;
    private String username;
    private String realName;
    private String appKey;
    private String header;

    private Boolean isAdmin;
    private List<String> enterpriseList;

    private Map<String,Object> roles = new HashMap<>();

    public ProfileResult(SysUser user, String appKey, Boolean isAdmin, List<String> enterpriseList) {
        if (!StringUtils.isEmpty(user.getUserId())){
            this.userId = user.getUserId();
            this.username = user.getUserName();
            this.appKey = appKey;
            this.header = user.getHead();
            this.realName = user.getRealName();
            this.isAdmin = isAdmin;
            this.enterpriseList = enterpriseList;
        }
    }



    @Override
    public String getAuthCacheKey() {
        return null;
    }
}
